package stdio.costa.imoca.converter;

import stdio.costa.imoca.dto.ReceiverListDTO;
import stdio.costa.imoca.model.Receiver;
import weiboclient4j.model.User;

public class WeiboUserList2ReceiverList {

	public static ReceiverListDTO convert(
			weiboclient4j.model.UserList weiboUserList) {

		if (weiboUserList == null) {
			return new ReceiverListDTO();
		}

		ReceiverListDTO receiverList = new ReceiverListDTO();

		Receiver receiver = new Receiver();

		for (User user : weiboUserList.getUsers()) {
			receiver = WeiboUser2Receiver.convert(user);
			receiverList.getReceivers().add(receiver);
		}
		return receiverList;
	}
}
